package com.iwop.moto.service;

import com.iwop.moto.exceptions.MyException;
import com.iwop.moto.model.PO.PromotionVo;
import com.iwop.moto.model.SuperRecordModel;
import com.iwop.moto.model.User;

import java.util.List;

/**
 * 按模块进行
 * @author  Created by huyuangui on 2016/7/7.
 */
public interface UserService {
    /*********
     * 登录  用户 和 密码
     * @param user
     * @return
     ********/
    User login(User user);

    /**
     * 注册
     * @param user
     * @return
     */
    void register(User user);

    /***
     * 查找用户
     * @param user
     * @return
     */
    User findUserByUser(User user);

    User findUserByParam(User user);

    /**
     * 保存用户
     * @param user
     * @return
     */
    User save(User user);

    User updatebyUserType(User user);

    /**
     * 获取最后生成的用户
     * @return
     */
    User getLastUser();

    /**
     * 根据用户Id获取用户数据
     * @param sid
     */
    User getUserBySid(String sid);

    /**
     * 根据用户类型校验
     * @param user [tel:手机号] [pwd:密码(MD5密文)][userType:用户类型1:维修店 5:服务商]
     */
    User findLoginByUserType(User user);

    /**
     * 判断openid是否已经注册
     * @param SRModel
     * @return
     */
    boolean checkUserByOpenId(SuperRecordModel SRModel);

    /**
     * 判断该手机号是否注册过
     * @param SRModel
     * @return
     */
    boolean checkUserByTel(SuperRecordModel SRModel);

    /**
     * @param SRModel
     * @return
     */
    SuperRecordModel findUserByOpenId (SuperRecordModel SRModel);

    SuperRecordModel findUserByPromotionCode(String promotion_code);

    void insertUser(SuperRecordModel SRModel);

    void updateUser(SuperRecordModel SRModel);

    SuperRecordModel findUserAndStoreByUserId(String userId);

    List<SuperRecordModel> findUserByPromotion(SuperRecordModel SRModel);

    void updateUserAuditStatus(SuperRecordModel SRModel);

    SuperRecordModel findUserBySid(SuperRecordModel SRModel);

    List<SuperRecordModel> findUsersByAuditStatus(SuperRecordModel SRModel);
    List<User> findUsersByTel(String tel);

    Integer findCountMemberArea (SuperRecordModel SRModel);

    void upUserBirthday(SuperRecordModel srModel);

    List<SuperRecordModel> findAdminAuditList(SuperRecordModel srModel);

    void delete(String sid);

    List<SuperRecordModel> findUsersByDistrict(SuperRecordModel SRModel);

    Long findUsersByDistrictCount(SuperRecordModel SRModel);

    Long findServiceCountByDistrict (SuperRecordModel SRModel);

    Long findAdminAduitCount();

    Long findServiceAduitCount();

    Long findAdminAduitHistoryCount();

    void updateAuditDescribe(SuperRecordModel SRModel);

    User getUserMapBySid(SuperRecordModel srModel);

    void updateUnionId(SuperRecordModel SRModel);

    void updateUserRmoneyBySid(User user);

    List<SuperRecordModel> findUserTotalUserType(SuperRecordModel superRecordModel);

    List<SuperRecordModel> getTotalUserType(SuperRecordModel superRecordModel);

    List<User> findUserAll();

    void updatePopular(SuperRecordModel srModel);

    void updateMagicBean(SuperRecordModel srModel);

    void updateUserByDeviceId(User user);

    void updateUserByTel(User user);

    void updateRedPacketBySid(User userBySid);

    void updateRmoneyAndRedPacketByid(User user);

    List<SuperRecordModel> getUserForDate(SuperRecordModel srModel);

    List<SuperRecordModel> findAdminAuditListFromDate(SuperRecordModel srm);

    void deleteUser(String sid);

    /**
     * 余额交易
     * @param user 用户
     * @param user 支付金额（前端全部计算后的金额）
     * @param superRecordModel 佣金
     * @return
     */
    void balanceHandle(User user, SuperRecordModel superRecordModel) throws MyException;

    /**
     * 查询 入驰商铺列表
     *
     */
    List<SuperRecordModel> findEnterStoresListByMap(SuperRecordModel srm);

    /**
     * 查询 入驰商铺详情列表
     *
     */
    SuperRecordModel findEnterStoresListDetailByMap(SuperRecordModel srm);

    /**
     * 导出入驰商铺
     *
     */
    List<SuperRecordModel> findEnterStoresListExportByMap(SuperRecordModel srm);

    Long findEnterStoresListByMapCount(SuperRecordModel srm);

    /**
     * 分销用户收入
     * @param userId 交易用户id
     * @param orderId 交易订单id
     * @param orderMoney 交易金额
     */
    public void userProceeds(String userId, String orderId, Double orderMoney);

    /**
     * 分销收益详情
     * @param userId
     * @return PromotionVo
     */
    public PromotionVo findUserPromotionByUserId(String userId);

    Boolean cashUserProceedsMoney(String  userId);


}
